/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./src/eventbus.js":
/*!*************************!*\
  !*** ./src/eventbus.js ***!
  \*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"on\": () => (/* binding */ on),\n/* harmony export */   \"ons\": () => (/* binding */ ons),\n/* harmony export */   \"emit\": () => (/* binding */ emit),\n/* harmony export */   \"remove\": () => (/* binding */ remove),\n/* harmony export */   \"removes\": () => (/* binding */ removes)\n/* harmony export */ });\nconst eventMap = {}\r\n\r\n/**\r\n * observer\r\n * @param {*} key \r\n * @param {*} callback \r\n */\r\nfunction on(key, callback) {\r\n  if (!key || !callback) return\r\n\r\n  const event = eventMap[key]\r\n  if (!!event) {\r\n    event.queue.push(callback)\r\n  } else {\r\n    eventMap[key] = { queue: [callback] }\r\n  }\r\n}\r\n\r\nfunction ons(keys=[], callback) {\r\n  if (!keys || keys.length === 0 || !callback) return\r\n\r\n  for (const key of keys) {\r\n    on(key, callback)\r\n  }\r\n}\r\n\r\n/**\r\n * trigger observer\r\n * @param {*} key \r\n * @param {*} params \r\n * @returns \r\n */\r\nfunction emit(key, params) {\r\n  if (!key) return\r\n\r\n  for (const eventKey in eventMap) {\r\n    if (eventKey === key) {\r\n      eventMap[eventKey].queue.forEach(c=>{\r\n        c(params)\r\n      })\r\n      return \r\n    }\r\n  }\r\n}\r\n\r\n/**\r\n * remove observer\r\n * @param {*} key \r\n * @param {*} callback \r\n * @returns \r\n */\r\nfunction remove(key, callback) {\r\n  if (!key || !callback) return\r\n\r\n  for (const eventKey in eventMap) {\r\n    if (eventKey === key) {\r\n      const val = eventMap[eventKey]\r\n      val.queue = val.queue.filter(c=>c!==callback)\r\n      return \r\n    }\r\n  }\r\n}\r\n\r\nfunction removes(keys=[], callback) {\r\n  if (!keys || keys.length === 0 || !callback) return\r\n\r\n  for (const key of keys) {\r\n    remove(key, callback)\r\n  }\r\n}\n\n//# sourceURL=webpack://js-guava/./src/eventbus.js?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The require scope
/******/ 	var __webpack_require__ = {};
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./src/eventbus.js"](0, __webpack_exports__, __webpack_require__);
/******/ 	var __webpack_export_target__ = exports;
/******/ 	for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
/******/ 	if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
/******/ 	
/******/ })()
;